package com.senthink.gl.business.domain.repository;

import com.senthink.gl.business.domain.entity.People;
import com.senthink.gl.business.domain.entity.PeopleEpi;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Optional;

/**
 * 民众-防疫Repository
 *
 * @author zooqi@senthink.com
 * @date 2017/11/28
 */
public interface PeopleEpiRepository extends JpaRepository<PeopleEpi, Long>, JpaSpecificationExecutor<PeopleEpi> {

    /**
     * 查找
     *
     * @param peid
     * @return
     */
    Optional<PeopleEpi> findTopByPeid(String peid);

    /**
     *
     * @param people
     * @return
     */
    Optional<PeopleEpi> findTopByPeople(People people);


    /**
     * 删除
     *
     * @param peid
     * @return
     */
    @Transactional
    long deleteByPeid(String peid);

    /**
     *
     * @param people
     * @return
     */
    long deleteAllByPeople(People people);



}